<?php

namespace app\index\model;
use think\Model;
use think\Db;

class Method extends Model
{

    /**
     * [获取攻略列表]
     * @param array $field 查询字段
     * @param array $where 查询条件
     * @param int $page  页数
     * @param int $limit  每页条数
     * @param bool $isCount  是否查询条数
     * @return false|int|\PDOStatement|string|\think\Collection
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    static function getMethodList($field=[],$where=[],$page=1,$limit=10,$isCount = false){

        $query = Method::alias('t1')->where($where);

        if ($isCount){

            return $query->count();

        }else{

            return $query
                    ->field($field)
                    ->page($page,$limit)
                    ->join("lv_user t2","t1.uid = t2.uid",'left')
                    ->order("mid","desc")
                    ->select();

        }

    }

}